#ifndef __MPU6050_2_H
#define __MPU6050_2_H

#include <my_sys.h>

#include "mpu6050.h"

//MPU6050_2 AD0���ƽ�
//#define MPU_2_AD0_CTRL_PORT 	GPIOA
//#define MPU_2_AD0_CTRL_PIN 		GPIO_PIN_3

//#define MPU_2_AD0_CTRL_SET		gpio_bit_set(MPU_2_AD0_CTRL_PORT, MPU_2_AD0_CTRL_PIN)
//#define MPU_2_AD0_CTRL_RESET	gpio_bit_reset(MPU_2_AD0_CTRL_PORT, MPU_2_AD0_CTRL_PIN)
#define MPU_2_AD0_CTRL_SET		__NOP()
#define MPU_2_AD0_CTRL_RESET	__NOP()

//#define MPU_2_AD0_CTRL			PAout(12)	//����AD0��ƽ,�Ӷ�����MPU_2��ַ

 
//���AD0��(9��)�ӵ�,IIC��ַΪ0X68(���������λ).
//�����V3.3,��IIC��ַΪ0X69(���������λ).
#define MPU_2_ADDR				0X69


////��Ϊģ��AD0Ĭ�Ͻ�GND,����תΪ��д��ַ��,Ϊ0XD1��0XD0(�����VCC,��Ϊ0XD3��0XD2)  
//#define MPU_2_READ    0XD1
//#define MPU_2_WRITE   0XD0

u8 MPU_2_Init(void); 								//��ʼ��MPU_26050
u8 MPU_2_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC����д
u8 MPU_2_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC������
u8 MPU_2_Write_Byte(u8 reg,u8 data);				//IICдһ���ֽ�
u8 MPU_2_Read_Byte(u8 reg);						//IIC��һ���ֽ�

u8 MPU_2_Set_Gyro_Fsr(u8 fsr);
u8 MPU_2_Set_Accel_Fsr(u8 fsr);
u8 MPU_2_Set_LPF(u16 lpf);
u8 MPU_2_Set_Rate(u16 rate);
u8 MPU_2_Set_Fifo(u8 sens);


short MPU_2_Get_Temperature(void);
u8 MPU_2_Get_Gyroscope(short *gx,short *gy,short *gz);
u8 MPU_2_Get_Accelerometer(short *ax,short *ay,short *az);

#endif




































